home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Sample Code / Snippets / Files / resolveRelativeAlias / resolveRelativeAlias ReadMe next >
Encoding:
Text File  |  1992-07-15  |  1.4 KB  |  36 lines  |  [TEXT/ttxt]

  1.  resolveRelativeAlias MPW Tool (System 7 only)
  2.  
  3. Greg Robbins  3/92
  4.  
  5.     Scenario:
  6.  
  7.   A document contains an alias to a file in a known folder.  The problem
  8.   is that the document might be on a floppy, and the known folder might
  9.   be on a drive whose name is unknown.
  10.   
  11.   For example, say the boot drive will contain "Super Folder" in the root
  12.   directory, and "Super File" in that folder.  The goal is to create an
  13.   alias to "Super File" which will work regardless of the drive's name.
  14.   
  15.     Solution:
  16.   
  17.   Create an alias to the the target (e.g. "SuperFile") which is relative to
  18.   the System file.  This presumes that the folder structure of the drive
  19.   is known, but makes no presumption about the name of the drive.
  20.   
  21.   This sample tool demonstrates the steps involved in creating and resolving
  22.   the alias.  Instead of creating a document to store the alias, the tool wimps
  23.   out and stores the alias in a preference file.
  24.   
  25.   The tool puts up a StandardGetFile dialog.  Selecting a file creates the
  26.   preference file containing the relative alias; clicking Cancel instead
  27.   gets the preference file, resolves it, and prints the vRefNum and name
  28.   of the target.
  29.   
  30.     Alternative strategies:
  31.   
  32.   Well, you could call PBGetVInfo to find the name of the boot volume
  33.   and then build a full pathname, or SetVol to the root directory of the
  34.   boot volume and then use a relative pathname.  But both of those
  35.   solutions are ugly and un-Seven like.
  36.